
#!/bin/bash
#description: use yum install jenkins
#
SOFTDIR="/opt/tools"
VER=$1
[ ! -d $SOFTDIR ] && mkdir $SOFTDIR
if [ $# -ne 1 ];then
        echo "Usage $0 <Version>"
        exit 1
fi
#安装jdk环境
yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel
#下载rpm包，并安装
#wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo
#rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key
cd $SOFTDIR
#wget http://pkg.jenkins.io/redhat-stable/jenkins-${VER}.noarch.rpm
wget https://mirrors.tuna.tsinghua.edu.cn/jenkins/redhat-stable/jenkins-${VER}.noarch.rpm
yum -y localinstall jenkins-${VER}.noarch.rpm

#启动jenkins
systemctl enable jenkins
systemctl start jenkins

#配置防火墙
firewall-cmd --add-port=8080/tcp --permanent
firewall-cmd --reload



